import request from "@/utils/request";
import { AxiosPromise } from "axios";
import { ItemPageResult, ItemForm } from "./types";

/**
 * 考试进度列表
 *
 * @param queryParams
 */
export function getExamList(queryParams?: any): AxiosPromise<ItemPageResult> {
  return request({
    url: "/adminApi/exam/page",
    method: "get",
    params: queryParams,
  });
}

/**
 * 获得考生列表
 *
 * @param queryParams
 */
export function getExamineeList(
  queryParams?: any
): AxiosPromise<ItemPageResult> {
  return request({
    url: "/adminApi/exam/examinee",
    method: "get",
    params: queryParams,
  });
}

/**
 * 更新考生状态
 *
 * @param data
 */
export function updateStatus(data: ItemForm) {
  return request({
    url: "/adminApi/exam/updateStatus",
    method: "put",
    data: data,
  });
}

/**
 * 理论成绩列表
 *
 * @param queryParams
 */
export function getTheoreticalScoreList(
  queryParams?: any
): AxiosPromise<ItemPageResult> {
  return request({
    url: "/adminApi/score/statistics",
    method: "get",
    params: queryParams,
  });
}

/**
 * 获得考试详情
 *
 * @param queryParams
 */
export function getExamDetails(queryParams?: any): AxiosPromise<any> {
  return request({
    url: "/adminApi/exam/get",
    method: "get",
    params: queryParams,
  });
}

/**
 * 导出
 *
 */
export function exportGrades(id: any) {
  return request({
    url: "/adminApi/score/download?id=" + id,
    method: "get",
    responseType: "arraybuffer",
  });
}
